<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加用户</title>
    <script src="js/jquery3.6.0.js"></script>
</head>
<body>
<form action="admin" method="post">
    <!--name,gender,tel,credits-->
    <input type="hidden" name="op" value="addUser">
    姓名<input type="text" name="name"> <br>
    性别<input type="radio" name="gender" value="1" checked="checked">男
        <input type="radio" name="gender" value="0" checked="checked">女 <br>
    电话<input type="text" name="tel" onblur="validateTel()" id="tel">
    <span id="telInfo" style="font-weight: bolder;color: red;"></span> <br>
    积分<input type="text" name="credits"> <br>
    <input type="submit" value="注册">
</form>
<script type="text/javascript">
    //页面一加载完，就会立即执行它里面的代码
    function validateTel(){
        let tel = $("#tel").val();
        // alert(tel)
        $.get("user?op=isTelExists",{"tel":tel},function(res){
            $("#telInfo").text(res)
            // console.info(res)
        })
    }
</script>
</body>
</html>